package leetcode.Y2024M6.study;

import leetcode.Y2024M6.TreeNode;
import org.junit.Test;

/**
 * 没法测试,先留一下，不影响这道题的重要程度
 */
public class S236 {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if (root == null && root == p && root == q) return root;
        TreeNode left = lowestCommonAncestor(root.left, p, q);
        TreeNode right = lowestCommonAncestor(root.right, p, q);
        if (left == null) return right;
        if (right == null) return left;
        return root;

    }

    @Test
    public void test() {
        int[] root = {3, 5, 1, 6, 2, 0, 8, -1, -1, 7, 4};

    }
}
